//
//  AJTTItemDetailsController.swift
//  JourneyThroughTime
//
//  Created by iOS-Czz on 2023/11/6.
//

import UIKit

class AJTTItemDetailsController: AJTTBaseViewController {
    var model = AJTTItemModel()
    @IBOutlet var modernTV: UITextView!
    @IBOutlet var earlyTV: UITextView!
    @IBOutlet var earlyPic: UIImageView!
    @IBOutlet var nameLabel: UILabel!
    @IBOutlet var ageLabel: UILabel!
    @IBOutlet var bgView: UIView!
    @IBOutlet var mordernPic: UIImageView!
    override func viewDidLoad() {
        super.viewDidLoad()
        setPageData()
        // Do any additional setup after loading the view.
    }
    func setPageData(){
        self.earlyPic.image = UIImage.loadImage(self.model.earlyPic)
        self.mordernPic.image = UIImage.loadImage(self.model.modernPic)
        self.nameLabel.text = self.model.name
        self.ageLabel.text = "Invented in \(self.model.invention)"
        self.earlyTV.text = self.model.earlyDesc
        self.modernTV.text = self.model.modernDesc
    }
    @IBAction func clickBackAction(_ sender: Any) {
        self.navigationController?.popViewController(animated: true)
    }
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        self.bgView.addRoundCorners(topLeftRadius: 15, topRightRadius: 15, bottomLeftRadius: 0, bottomRightRadius: 0, borderWidth: 0, borderColor: .red)
    }
    @IBAction func clickViewHistoryAction(_ sender: Any) {
        let historyVC = AJTTViewHistoryController()
        historyVC.htmlContent = self.model.evolution
        historyVC.modalPresentationStyle = .fullScreen
        self.present(historyVC, animated: true)
    }
    
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
